package server.world.character

import server.world._
import server.world.map._
import server.world.action._

class NPC(tile:Tile) extends GameCharacter(tile:Tile){ 
  
  def wantToAct():Boolean = true
  
  def getAction():Action ={
    if(!findEnemy.isEmpty){
      //val enemy:GameCharacter = findEnemy.map(x => x.characterOnTile).head
      //if(enemy.tile.isAdjacent(this.tile)) return new Attack(this,enemy)
      //else return new Move(this,findPathTile(enemy.tile))
    }
    return new Attack(this,this)
  }
  
  def setAction() = TurnProcessor.addAction(new Move(this,this.tile))
  
  
 // def findPathTile(loc:Tile):Tile = new NodeGraph(tile.map.tileList).findPathFirstTile(tile, loc)
  
  def findEnemy():Option[Tile] = this.visibleTiles().find(x => x.characterOnTile != null & x.characterOnTile != this)
}

